Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: Use a faster comparison when enumeration filter strings don't have wildcards #324

Merged
merged 2 commits into from
Oct 2, 2018

Conversation

wilbaker
Copy link
Member

@wilbaker wilbaker commented Oct 2, 2018

Update ActiveEnumeration to use string.Equals rather than Utils.IsFileNameMatch when the enumeration filter string does not have wildcards.

Times with scenario provided by @kyle-rader

  Baseline Times (sec) PR Changes (sec)
  48.23 9.83
  41.16 9.37
  44.49 10.76
  41.18 10.35
Average 43.77 10.08

@@ -107,15 +109,31 @@ public string GetFilterString()
return this.filterString;
}

private static bool NameMatchsNoWildcardFilter(string name, string filter)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: Matches

@wilbaker wilbaker requested a review from nickgra October 2, 2018 18:36

// Use our own enumerator to avoid having to dispose anything
private ProjectedFileInfoEnumerator fileInfoEnumerator;
private FileNamePatternMatcher patternMatcher;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename these to better names:

patternMatcher -> doesPatternMatch
wildcardPatternMatcher -> doesWildcardPatternMatch

Copy link
Contributor

@sanoursa sanoursa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great and that's a really nice perf win!

@wilbaker wilbaker merged commit 8dba3b4 into microsoft:master Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants